package com.hzj.service.impl;

import com.hzj.pojo.VoteItem;
import com.hzj.mapper.VoteItemMapper;
import com.hzj.service.VoteItemService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hzj
 * @since 2021-03-19
 */
@Service
public class VoteItemServiceImpl extends ServiceImpl<VoteItemMapper, VoteItem> implements VoteItemService {
    @Autowired
    VoteItemMapper vim;

    @Override
    @Transactional
    public boolean insertVoteItemList(List<VoteItem> list) {
        try {
            int i = vim.insertVoteItemList(list);
            if (i != list.size()) {
                throw new Exception("插入选项表异常");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }


        return true;
    }
}
